// 响应数据
class Response {
    // 成功响应
    success = (res, data = {}) => {
        res.json({
            code: 200,
            message: "操作成功",
            data,
            success: true
        })
    }
    // 失败响应
    fail = (res, message) => {
        res.json({
            code: 200,
            message,
            success: false
        })
    }
    // 错误响应
    error = (res, err) => {
        res.json({
            code: 0,
            message: "操作失败",
            data: err,
            success: false
        })
    }
}

module.exports = new Response()

